﻿<%@ Page Language="C#" MasterPageFile="~/MasterPages/MasterPage.master" AutoEventWireup="true" CodeFile="CustProducts.aspx.cs" Inherits="Companies_Products" Title="Продукти на Клиенти" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
    <style type="text/css">
        .style1
        {
            width: 100%;
        }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <p>
        &nbsp;</p>
    <p>
        &nbsp;<table >
            <tr>
                <td>
        СПИСЪК НА ПРОДУКТИТЕ НА КЛИЕНТ:</td>
                <td>
                    Виж продуктите на друг клиент:</td>
            </tr>
            <tr>
                <td>
    <asp:BulletedList ID="BulletedList1" runat="server" DataSourceID="sdsCustomers" 
        DataTextField="Name" DataValueField="CompanyID" Font-Bold="True" 
        ForeColor="#993300" Font-Size="Large">
    </asp:BulletedList>
                </td>
                <td>
                    <asp:DropDownList ID="ddlAllCustomers" runat="server" 
        DataSourceID="sdsAllCustomers" DataTextField="Name" DataValueField="CompanyID" 
                        AutoPostBack="True" 
                        onselectedindexchanged="ddlAllCustomers_SelectedIndexChanged" Width="264px">
    </asp:DropDownList>
                </td>
            </tr>
        </table>
        
    </p>
    &nbsp;<asp:SqlDataSource ID="sdsAllCustomers" runat="server" 
        ConnectionString="<%$ ConnectionStrings:KonturConnectionString %>" 
        
        SelectCommand="SELECT [CompanyID], [Name] FROM [Companies] WHERE (CompanyTypeID =1)">
    </asp:SqlDataSource>
    <br />
    <p>
        <asp:GridView ID="gvItems" runat="server" 
            DataSourceID="sdsItems" AllowPaging="True" AutoGenerateColumns="False" 
            AllowSorting="True" BackColor="White" BorderColor="#DEDFDE" BorderStyle="None" 
            BorderWidth="1px" CellPadding="4" GridLines="Vertical" ForeColor="Black" 
            DataKeyNames="ItemID">
            <FooterStyle BackColor="#CCCC99" />
            <RowStyle BackColor="#F7F7DE" />
            <Columns>
                <asp:BoundField DataField="ItemCode" HeaderText="Код" 
                    SortExpression="ItemCode" />
                <asp:BoundField DataField="NameBG" HeaderText="Име БГ" 
                    SortExpression="NameBG" />
                <asp:BoundField DataField="NameEN" HeaderText="Име АН" 
                    SortExpression="NameEN" />
                <asp:BoundField DataField="DDU1_EUR" HeaderText="DDU цена в EUR без обков" 
                    SortExpression="DDU1_EUR" DataFormatString="{0:f}" />
                <asp:BoundField DataField="DDU2_EUR" HeaderText="DDU цена на обкова в EUR" 
                    SortExpression="DDU2_EUR" DataFormatString="{0:f}" />
                <asp:BoundField DataField="DDUEUR" HeaderText="DDU цена с обков в EUR" 
                    SortExpression="DDUEUR" DataFormatString="{0:f}" />
                <asp:BoundField DataField="DDUBGN" HeaderText="DDU цена с обков в ЛВ" 
                    SortExpression="DDUBGN" DataFormatString="{0:f}" />
                <asp:BoundField DataField="Count1" HeaderText="Бр./Комплект" 
                    SortExpression="Count1" />
                <asp:BoundField DataField="Count2" HeaderText="Комплекти в кашон" 
                    SortExpression="Count2" />
                <asp:BoundField DataField="Count3" HeaderText="Кашони в палет" 
                    SortExpression="Count3" />
                <asp:BoundField DataField="Count4" HeaderText="Комплекти в палет" 
                    SortExpression="Count4" />
            </Columns>
            <PagerStyle BackColor="#F7F7DE" ForeColor="Black" HorizontalAlign="Right" />
            <SelectedRowStyle BackColor="#CE5D5A" Font-Bold="True" ForeColor="White" />
            <HeaderStyle BackColor="#6B696B" Font-Bold="True" ForeColor="White" />
            <AlternatingRowStyle BackColor="White" />
        </asp:GridView>
        <asp:SqlDataSource ID="sdsItems" runat="server" 
            ConflictDetection="CompareAllValues" 
            ConnectionString="<%$ ConnectionStrings:KonturConnectionString %>" 
            OldValuesParameterFormatString="original_{0}" 
            
            SelectCommand="SELECT     Items.ItemID, Items.ItemCode, Items.NameBG, Items.NameEN, Items.EXW1, Items.EXW2, Items.EXW3, Items.DDU1_EUR, Items.DDU2_EUR, Items.DDUEUR, 
                      Items.DDUBGN, Items.Count1, Items.Count2, Items.Count3, Items.Count4, Items.CompanyID, Companies.CompanyTypeID
FROM         Items INNER JOIN
                      Companies ON Items.CompanyID = Companies.CompanyID
WHERE     (Companies.CompanyTypeID = 1)">
        </asp:SqlDataSource>
    </p>
    <p>
        <asp:SqlDataSource ID="sdsCustomers" runat="server" 
            ConnectionString="<%$ ConnectionStrings:KonturConnectionString %>" 
            
            SelectCommand="SELECT [CompanyID], [Name] FROM [Companies] WHERE ([CompanyTypeID] = 1)">
        </asp:SqlDataSource>
    </p>
    <p>
        <asp:Button ID="btnAddNewProduct" runat="server" onclick="btnAddNewProduct_Click" 
            Text="Добави Нов Продукт" />
    &nbsp;<asp:Button ID="btnEditProduct" runat="server" 
            Text="Редактиране на продукт" onclick="btnEditProduct_Click" />
    &nbsp;<asp:Button ID="btnDelProduct" runat="server" Text="Изтриване на продукт" 
            onclick="btnDelProduct_Click" />
    </p>
    </asp:Content>

